using System;
using ACS.Runtime.Visitors;

namespace ACS.Runtime.Types
{
    public class StringType : BaseType
    {
        private string _val;


        public string Val
        {
            get { return _val; }
        }

        public StringType()
        {
            _val = "";
        }

        public StringType(string val)
        {
            _val = val;
        }

        public static implicit operator StringType(string value)
        {
            return new StringType(value);
        }

        public static implicit operator string(StringType value)
        {
            return value.Val;
        }

        public override int Accept(IVisitor visitor)
        {
            return visitor.Visit(this);
        }

        public static bool operator ==(StringType b1, StringType b2)
        {
            return b1._val == b2._val;
        }

        public static bool operator !=(StringType b1, StringType b2)
        {
            return b1._val != b2._val;
        }
        public override void Assign(BaseType from)
        {
            Assign((StringType) from);
        }

        public void Assign(StringType from)
        {
            _val = from._val;
        }
    }
}